// +----------------------------------------------------------------------
// | Manong.Cloud [ 领酷码农云 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2020 http://www.manong.cloud All rights reserved.
// +----------------------------------------------------------------------
// | Author: 稻草人 <qinuoyun@qq.com>
// +----------------------------------------------------------------------

//判断环境变量是否存在

let database = {
  "dialect": "mysql",
  "hostname": "81.68.89.242",
  "database": "building",
  "username": "building",
  "password": "EtfscRTBLb8FdjHZ",
  "hostport": "3306",
  "tableprefix": "hz_"
};

if (process && process.env && process.env.db_hostname) {
  database = {
    "dialect": process.env.db_dialect || "mysql",
    "hostname": process.env.db_hostname || "81.68.89.242",
    "database": process.env.db_database || "building",
    "username": process.env.db_username || "building",
    "password": process.env.db_password || "EtfscRTBLb8FdjHZ",
    "hostport": process.env.db_hostport || "3306",
    "tableprefix": process.env.db_tableprefix || "qn_"
  };
}

/**
 * 加密解密部分
 * @type {{data: string, remark: string, open: {}}}
 */
let security = {
  "disable": true,
  "aes": "LWD65Z321WIOP1KL",
  "des-request": {
    'remark': '公钥开放，私钥私有',
    'private': 'MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAICJY0lQuxBKF9hB9Hxf1d7oXISHf7jIna1Db+5cAGdXFiSBVn0UYl8a940nOkF8KE56Z5qXM6YO1cFwJ3fABBiBcLWe7qHUmyZWKFNJQSlIdH0DY1R8dDbeRVxUkzMf3DsYJC8MNSGzi2jzUTTyPHzn/+RFaGF3L7ro00i8f4gFAgMBAAECgYA9kJCLpy1SCgsNu9l8UPLBR444tCXKvdw4Btrv0gUneiDS71gbpM3RO7tiUm2mu+8aV6qT8uP8H5Lmie99fez3mgwLdMRHL3TWfTkUAj7f0RED+tYlXuZ9HAllkWiRczM3IBTAb3PGCm7PrvIyivyRwnK9ELF+CC1qbwTy/GRQAQJBALiatHpZHnNiZOWcFvPMsOv10WLiSW/iR6mAfcRM0mQoFpgS1ak6fc6xGm0wSoQhPZVcsGNhdXiKAnpM+QjjegUCQQCyP4pLfN4m+aYq0nXiX8mS6ua005MjkdH003iMaHodasHO/1JF/irhqklSnqDTVtuSvEKdxw8EWCgwzyO7kzYBAkAd6syG63x43KBXacV6e1jM1Mi7Ssr1++j7OlynfH+4RZrryFmiFF2hKqiKu4HICg8N7riTUo8UGuGt6l2NqDf1AkAXzna5CE9fYz53P66w8lwovCjeA9gGCybAjTHvhtCwdx61d9JUONMfWq/6Uedm8pXW7j/zdK+jw+ZyRmgeWFYBAkAFKlqexl0TFjAZ+cwJVjSDFwP1oEYb9MQC5yT6N1mUzsEZhi0s3D5KF0j0biDnrwC4QPea2LSiG8hISy5ECrkQ',
    'public': 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCAiWNJULsQShfYQfR8X9Xe6FyEh3+4yJ2tQ2/uXABnVxYkgVZ9FGJfGveNJzpBfChOemealzOmDtXBcCd3wAQYgXC1nu6h1JsmVihTSUEpSHR9A2NUfHQ23kVcVJMzH9w7GCQvDDUhs4to81E08jx85//kRWhhdy+66NNIvH+IBQIDAQAB'
  },
  "des-response": {
    'remark': '公钥用于对response加密，私钥开放解密返回数据',
    'private': 'MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBALk/tO0BJ0694DaP4wz0CMsgEdY3cMixbktc+cAkRHrMPP+2Cu2B0exuWpiogU33HG1JgxMMF7hQ/h2srD5c1McLQTS8QEyzHsTYJI97vGf16o5bQx8P0GdewO//ns1dMGYpBsfsY7A+qVFZVXNwezgy8B8Ve2vAAjAqlzQOxhQ5AgMBAAECgYATZi99LkS+gzXKoPDG93tAQkB77VxbN/Fz5O2miGW/cknlAVxNmO2x07CbEfJQhtMsQql+QiLtw1WJJ/71nOUPMRKnOwwEuFH+cs8PckGz2TSOE2TU2Zt9a0yXGpCJpJo9K7/Np51SFyX83A+/NDZvRZrND6SzKeZX/2AoG7ligQJBAPZQDzeE/AOW+tmT7kfFEPk2gsJojAoknJp0XuVZtftUecxRtVgxO1J1l6lK/IR1AbtUI0/stA7qGzGtfCo5tAkCQQDAiNcfOaBsb4081uVqYirTW7R2dx6Wf//HsXPHI2Z+UxKYufGp1TbMV/tpOFXf1xU66sbTCEDAl7GvrzYppkqxAkEArOxD4pxwOSzz63CZprVJV0zXvBidyDkv4Je2T5oN0ubZo4HxqHrXxOpdkTLd2Tg0AQnuyJvLRXVBpjy/oP1l0QJAAwIgWlyMJSWZD1pMO11NTgAg0bkKwU8+r+AV7waek1q476n4HK84K/kz9HDs5pJ1wnXopWN7n4a/P/982SnAAQJAXa3danz0W32mO1B4wsHDuHkOABKmO4tlbHfnkvaKSAZ8wHzdFC3peuZmsguOQmVshVBseybGj63TSC68CLa4TA==',
    'public': 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC5P7TtASdOveA2j+MM9AjLIBHWN3DIsW5LXPnAJER6zDz/tgrtgdHsblqYqIFN9xxtSYMTDBe4UP4drKw+XNTHC0E0vEBMsx7E2CSPe7xn9eqOW0MfD9BnXsDv/57NXTBmKQbH7GOwPqlRWVVzcHs4MvAfFXtrwAIwKpc0DsYUOQIDAQAB'
  }
}

const config = {
  "port": 6543,
  "database": database,
  security,
  "whitelist": [
    "/login",
    "/admin",
    "/api/account/bindWeApp",
    "/api/login/index",
    "/api/login/authorize",
    "/api/login/code",
    "/api/login/weCode",
    "/api/login/synchro",
    "/api/login/weApp",
    "/api/login/register",
    "/api/user/addOrUpdate",
    "/api/system/msg",
    "/api/config/init",
    "/api/config/area",
    "/api/config/getInit",
    "/api/contact/index",
    "/api/appCompany/view",
    "/api/config/address",
    "/api/demo/code",
    "/api/demo/index",
    "/api/app/cloud/user/index",
    "/api/demo/test",
    "/api/develop/index",
    "/api/default/demo"
  ]
};


module.exports = config;
